#!/bin/bash
jar_name=
current_dir=$(cd `dirname $0`; pwd)
for jar_name in `ls .|egrep '*.jar|*.war'`
do
   if [ -n "$jar_name" ]; then
      echo "find $jar_name"
   fi
   break

done

if [ "$jar_name" = "" ]; then
   echo "not find *.jar or *.war"
   exit 11
fi



echo "stop $jar_name"
pid=`ps -ef | grep "\-\-pwd=${current_dir}/${jar_name}" | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
   echo "kill pid $pid"
  kill -9 $pid
fi

echo "success"
